class VideoItem {
  final String id;
  final String videoUrl;
  final String coverImage;
  final String? title;
  final String? author;
  final String? avatarUrl; // 用户头像URL
  final int? likeCount;
  final int? commentCount;
  final int? shareCount;

  VideoItem({
    required this.id,
    required this.videoUrl,
    required this.coverImage,
    this.title,
    this.author,
    this.avatarUrl,
    this.likeCount,
    this.commentCount,
    this.shareCount,
  });

  factory VideoItem.fromJson(Map<String, dynamic> json) {
    return VideoItem(
      id: json['id'] ?? '',
      videoUrl: json['videoUrl'] ?? '',
      coverImage: json['coverImage'] ?? '',
      title: json['title'],
      author: json['author'],
      avatarUrl: json['avatarUrl'],
      likeCount: json['likeCount'],
      commentCount: json['commentCount'],
      shareCount: json['shareCount'],
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'videoUrl': videoUrl,
      'coverImage': coverImage,
      'title': title,
      'author': author,
      'avatarUrl': avatarUrl,
      'likeCount': likeCount,
      'commentCount': commentCount,
      'shareCount': shareCount,
    };
  }
}

